using System;
using System.Collections.Generic;
using System.Windows.Forms;

using CILDiffLibPrime;
using CILDiffLibPrime.Collectors;

namespace CILDiffConsole
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static int Main(String[] args)
        {
            try
            {
                if( args.Length == 2 )
                {
                    string assembA = args[0];
                    string assembB = args[1];

                    Visit v = new Visit();
                    ConsoleCollector collect = new ConsoleCollector();

                    v.RegisterCollector(collect, "output");
                    
                    v.CompareFiles(assembA, assembB);
                }
                else
                {
                    Console.WriteLine("usage: CILDiffConsole.exe file_before.exe file_after.exe");
                    return 1;
                }
            }
            catch( Exception e )
            {
                Console.WriteLine("Exception occurred.");
                Console.WriteLine("Message:" + e.Message);
                if( e.InnerException != null)
                {
                    Console.WriteLine("Inner:" + e.InnerException.Message);
                }
                Console.WriteLine(e.StackTrace);
                return 1;
            }
            return 0;
        }
    }
}